﻿using Seggu.Daos.Interfaces;
using Seggu.Dtos;
using Seggu.Services.DtoMappers;
using Seggu.Services.Interfaces;
using System.Collections.Generic;
using System.Linq;

namespace Seggu.Services
{
    public sealed class UseService : IUseService
    {
        private IUseDao useDao;

        public UseService(IUseDao useDao)
        {
            this.useDao = useDao;
        }

        public IEnumerable<UseDto> GetAll()
        {
            var uses = this.useDao.GetAll();
            return uses.OrderBy(x => x.Name).Select(u => UseDtoMapper.GetDto(u));
        }
    }
}
